// 时间戳转"YYYY年M月D日"格式
export function formatDate(timestamp: number): string {
  if (!timestamp) return '';
  // 兼容秒和毫秒,兼容数字和字符串
  const ts = typeof timestamp === 'string' ? parseInt(timestamp) : timestamp;
  if (ts.toString().length === 10) {
    timestamp = ts * 1000;
  }
  const date = new Date(timestamp);
  const year = date.getFullYear();
  const month = date.getMonth() + 1;
  const day = date.getDate();
  return `${year}年${month}月${day}日`;
} 